package com.spring.cloud.examples.controller;

import com.spring.cloud.examples.vo.TestPostVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * 返回這個台服務器端口號等信息
 */
@RestController
@RequestMapping("/server_info")
public class ServerInfoController {

    @Value("${server.port}")
    private String port;


    @RequestMapping("/port")
    @ResponseBody
    public String queryPort(){
        return "server port is "+port;
    }


    @RequestMapping(value = "/test_post",method= RequestMethod.POST)
    @ResponseBody
    public String testPost(@RequestBody TestPostVo testPostVo){
        return "id:"+testPostVo.getId()+" name:"+testPostVo.getName();
    }
}
